package com.jmag.nop.accountweb.controller;

import com.jmag.nop.accountapi.service.TAccountService;
import com.jmag.nop.service.common.annotation.ApiMapping;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

/**
 * @author jmag
 */
@RestController
//@RequestMapping("account")
public class TAccountController {

    @Autowired
    private TAccountService accountServiceImpl;

    /**
     * 扣减账户余额
     * @param userId 用户id
     * @param money 金额
     * @return
     */
    @RequestMapping("/account/decrease")
    public String decrease(@RequestParam("userId") Long userId,@RequestParam("money") BigDecimal money){
        accountServiceImpl.decrease(userId,money);
        return "Account decrease success";
    }

    //@RequestMapping("test")
    @ApiMapping(value = "account.search")
    public String test(){
        return "HELLWORD";
    }
}
